// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

package api

import (
	"strconv"
	"strings"

	"github.com/Azure/aks-engine/pkg/api/common"
)

// k8sComponentVersions defines "best known-working" component versions for each minor version of k8s
// Don't delete these hash table keys as they are consumed independently by AKS!
var k8sComponentVersions = map[string]map[string]string{
	"1.17": {
		"dockerEngine":                     "1.13.*",
		"dashboard":                        "kubernetes-dashboard-amd64:v1.10.1",
		"exechealthz":                      "exechealthz-amd64:1.2",
		"addon-resizer":                    "addon-resizer:1.8.5",
		"heapster":                         "heapster-amd64:v1.5.4",
		"metrics-server":                   "metrics-server-amd64:v0.3.5",
		"coredns":                          "coredns:1.6.2",
		"kube-dns":                         "k8s-dns-kube-dns-amd64:1.15.4",
		"addon-manager":                    "kube-addon-manager-amd64:v9.0.2",
		"dnsmasq":                          "k8s-dns-dnsmasq-nanny-amd64:1.15.4",
		"pause":                            "pause:1.2.0",
		"tiller":                           "tiller:v2.13.1",
		"rescheduler":                      "rescheduler:v0.4.0",
		"aci-connector":                    "virtual-kubelet:latest",
		ContainerMonitoringAddonName:       "oms:ciprod10182019",
		AzureCNINetworkMonitoringAddonName: "networkmonitor:v0.0.6",
		"cluster-autoscaler":               "cluster-autoscaler:v1.16.2",
		NVIDIADevicePluginAddonName:        "k8s-device-plugin:1.11",
		"k8s-dns-sidecar":                  "k8s-dns-sidecar-amd64:1.14.10",
		"nodestatusfreq":                   DefaultKubernetesNodeStatusUpdateFrequency,
		"nodegraceperiod":                  DefaultKubernetesCtrlMgrNodeMonitorGracePeriod,
		"podeviction":                      DefaultKubernetesCtrlMgrPodEvictionTimeout,
		"routeperiod":                      DefaultKubernetesCtrlMgrRouteReconciliationPeriod,
		"backoffretries":                   strconv.Itoa(DefaultKubernetesCloudProviderBackoffRetries),
		"backoffjitter":                    strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffJitter, 'f', -1, 64),
		"backoffduration":                  strconv.Itoa(DefaultKubernetesCloudProviderBackoffDuration),
		"backoffexponent":                  strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffExponent, 'f', -1, 64),
		"ratelimitqps":                     strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPS, 'f', -1, 64),
		"ratelimitqpswrite":                strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPSWrite, 'f', -1, 64),
		"ratelimitbucket":                  strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucket),
		"ratelimitbucketwrite":             strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucketWrite),
		"gchighthreshold":                  strconv.Itoa(DefaultKubernetesGCHighThreshold),
		"gclowthreshold":                   strconv.Itoa(DefaultKubernetesGCLowThreshold),
	},
	"1.16": {
		"dockerEngine":                     "1.13.*",
		"dashboard":                        "kubernetes-dashboard-amd64:v1.10.1",
		"exechealthz":                      "exechealthz-amd64:1.2",
		"addon-resizer":                    "addon-resizer:1.8.5",
		"heapster":                         "heapster-amd64:v1.5.4",
		"metrics-server":                   "metrics-server-amd64:v0.3.4",
		"coredns":                          "coredns:1.6.2",
		"kube-dns":                         "k8s-dns-kube-dns-amd64:1.15.4",
		"addon-manager":                    "kube-addon-manager-amd64:v9.0.2",
		"dnsmasq":                          "k8s-dns-dnsmasq-nanny-amd64:1.15.4",
		"pause":                            "pause:1.2.0",
		"tiller":                           "tiller:v2.13.1",
		"rescheduler":                      "rescheduler:v0.4.0",
		"aci-connector":                    "virtual-kubelet:latest",
		ContainerMonitoringAddonName:       "oms:ciprod10182019",
		AzureCNINetworkMonitoringAddonName: "networkmonitor:v0.0.6",
		"cluster-autoscaler":               "cluster-autoscaler:v1.16.2",
		NVIDIADevicePluginAddonName:        "k8s-device-plugin:1.11",
		"k8s-dns-sidecar":                  "k8s-dns-sidecar-amd64:1.14.10",
		"nodestatusfreq":                   DefaultKubernetesNodeStatusUpdateFrequency,
		"nodegraceperiod":                  DefaultKubernetesCtrlMgrNodeMonitorGracePeriod,
		"podeviction":                      DefaultKubernetesCtrlMgrPodEvictionTimeout,
		"routeperiod":                      DefaultKubernetesCtrlMgrRouteReconciliationPeriod,
		"backoffretries":                   strconv.Itoa(DefaultKubernetesCloudProviderBackoffRetries),
		"backoffjitter":                    strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffJitter, 'f', -1, 64),
		"backoffduration":                  strconv.Itoa(DefaultKubernetesCloudProviderBackoffDuration),
		"backoffexponent":                  strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffExponent, 'f', -1, 64),
		"ratelimitqps":                     strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPS, 'f', -1, 64),
		"ratelimitqpswrite":                strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPSWrite, 'f', -1, 64),
		"ratelimitbucket":                  strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucket),
		"ratelimitbucketwrite":             strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucketWrite),
		"gchighthreshold":                  strconv.Itoa(DefaultKubernetesGCHighThreshold),
		"gclowthreshold":                   strconv.Itoa(DefaultKubernetesGCLowThreshold),
	},
	"1.15": {
		"dockerEngine":                     "1.13.*",
		"dashboard":                        "kubernetes-dashboard-amd64:v1.10.1",
		"exechealthz":                      "exechealthz-amd64:1.2",
		"addon-resizer":                    "addon-resizer:1.8.5",
		"heapster":                         "heapster-amd64:v1.5.4",
		"metrics-server":                   "metrics-server-amd64:v0.2.1",
		"coredns":                          "coredns:1.6.2",
		"kube-dns":                         "k8s-dns-kube-dns-amd64:1.15.4",
		"addon-manager":                    "kube-addon-manager-amd64:v9.0.2",
		"dnsmasq":                          "k8s-dns-dnsmasq-nanny-amd64:1.15.4",
		"pause":                            "pause:1.2.0",
		"tiller":                           "tiller:v2.13.1",
		"rescheduler":                      "rescheduler:v0.4.0",
		"aci-connector":                    "virtual-kubelet:latest",
		ContainerMonitoringAddonName:       "oms:ciprod10182019",
		AzureCNINetworkMonitoringAddonName: "networkmonitor:v0.0.6",
		"cluster-autoscaler":               "cluster-autoscaler:v1.15.3",
		NVIDIADevicePluginAddonName:        "k8s-device-plugin:1.11",
		"k8s-dns-sidecar":                  "k8s-dns-sidecar-amd64:1.14.10",
		"nodestatusfreq":                   DefaultKubernetesNodeStatusUpdateFrequency,
		"nodegraceperiod":                  DefaultKubernetesCtrlMgrNodeMonitorGracePeriod,
		"podeviction":                      DefaultKubernetesCtrlMgrPodEvictionTimeout,
		"routeperiod":                      DefaultKubernetesCtrlMgrRouteReconciliationPeriod,
		"backoffretries":                   strconv.Itoa(DefaultKubernetesCloudProviderBackoffRetries),
		"backoffjitter":                    strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffJitter, 'f', -1, 64),
		"backoffduration":                  strconv.Itoa(DefaultKubernetesCloudProviderBackoffDuration),
		"backoffexponent":                  strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffExponent, 'f', -1, 64),
		"ratelimitqps":                     strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPS, 'f', -1, 64),
		"ratelimitqpswrite":                strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPSWrite, 'f', -1, 64),
		"ratelimitbucket":                  strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucket),
		"ratelimitbucketwrite":             strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucketWrite),
		"gchighthreshold":                  strconv.Itoa(DefaultKubernetesGCHighThreshold),
		"gclowthreshold":                   strconv.Itoa(DefaultKubernetesGCLowThreshold),
	},
	"1.14": {
		"dockerEngine":                     "1.13.*",
		"dashboard":                        "kubernetes-dashboard-amd64:v1.10.1",
		"exechealthz":                      "exechealthz-amd64:1.2",
		"addon-resizer":                    "addon-resizer:1.8.4",
		"heapster":                         "heapster-amd64:v1.5.4",
		"metrics-server":                   "metrics-server-amd64:v0.2.1",
		"coredns":                          "coredns:1.6.2",
		"kube-dns":                         "k8s-dns-kube-dns-amd64:1.15.4",
		"addon-manager":                    "kube-addon-manager-amd64:v9.0.2",
		"dnsmasq":                          "k8s-dns-dnsmasq-nanny-amd64:1.15.4",
		"pause":                            "pause:1.2.0",
		"tiller":                           "tiller:v2.13.1",
		"rescheduler":                      "rescheduler:v0.4.0",
		"aci-connector":                    "virtual-kubelet:latest",
		ContainerMonitoringAddonName:       "oms:ciprod10182019",
		AzureCNINetworkMonitoringAddonName: "networkmonitor:v0.0.6",
		"cluster-autoscaler":               "cluster-autoscaler:v1.14.6",
		NVIDIADevicePluginAddonName:        "k8s-device-plugin:1.11",
		"k8s-dns-sidecar":                  "k8s-dns-sidecar-amd64:1.14.10",
		"nodestatusfreq":                   DefaultKubernetesNodeStatusUpdateFrequency,
		"nodegraceperiod":                  DefaultKubernetesCtrlMgrNodeMonitorGracePeriod,
		"podeviction":                      DefaultKubernetesCtrlMgrPodEvictionTimeout,
		"routeperiod":                      DefaultKubernetesCtrlMgrRouteReconciliationPeriod,
		"backoffretries":                   strconv.Itoa(DefaultKubernetesCloudProviderBackoffRetries),
		"backoffjitter":                    strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffJitter, 'f', -1, 64),
		"backoffduration":                  strconv.Itoa(DefaultKubernetesCloudProviderBackoffDuration),
		"backoffexponent":                  strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffExponent, 'f', -1, 64),
		"ratelimitqps":                     strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPS, 'f', -1, 64),
		"ratelimitqpswrite":                strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPSWrite, 'f', -1, 64),
		"ratelimitbucket":                  strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucket),
		"ratelimitbucketwrite":             strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucketWrite),
		"gchighthreshold":                  strconv.Itoa(DefaultKubernetesGCHighThreshold),
		"gclowthreshold":                   strconv.Itoa(DefaultKubernetesGCLowThreshold),
	},
	"1.13": {
		"dockerEngine":                     "1.13.*",
		"dashboard":                        "kubernetes-dashboard-amd64:v1.10.1",
		"exechealthz":                      "exechealthz-amd64:1.2",
		"addon-resizer":                    "addon-resizer:1.8.4",
		"heapster":                         "heapster-amd64:v1.5.4",
		"metrics-server":                   "metrics-server-amd64:v0.2.1",
		"coredns":                          "coredns:1.6.2",
		"kube-dns":                         "k8s-dns-kube-dns-amd64:1.15.4",
		"addon-manager":                    "kube-addon-manager-amd64:v8.9.1",
		"dnsmasq":                          "k8s-dns-dnsmasq-nanny-amd64:1.15.4",
		"pause":                            "pause:1.2.0",
		"tiller":                           "tiller:v2.13.1",
		"rescheduler":                      "rescheduler:v0.4.0",
		"aci-connector":                    "virtual-kubelet:latest",
		ContainerMonitoringAddonName:       "oms:ciprod10182019",
		AzureCNINetworkMonitoringAddonName: "networkmonitor:v0.0.6",
		"cluster-autoscaler":               "cluster-autoscaler:v1.13.7",
		NVIDIADevicePluginAddonName:        "k8s-device-plugin:1.11",
		"k8s-dns-sidecar":                  "k8s-dns-sidecar-amd64:1.14.10",
		"nodestatusfreq":                   DefaultKubernetesNodeStatusUpdateFrequency,
		"nodegraceperiod":                  DefaultKubernetesCtrlMgrNodeMonitorGracePeriod,
		"podeviction":                      DefaultKubernetesCtrlMgrPodEvictionTimeout,
		"routeperiod":                      DefaultKubernetesCtrlMgrRouteReconciliationPeriod,
		"backoffretries":                   strconv.Itoa(DefaultKubernetesCloudProviderBackoffRetries),
		"backoffjitter":                    strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffJitter, 'f', -1, 64),
		"backoffduration":                  strconv.Itoa(DefaultKubernetesCloudProviderBackoffDuration),
		"backoffexponent":                  strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffExponent, 'f', -1, 64),
		"ratelimitqps":                     strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPS, 'f', -1, 64),
		"ratelimitqpswrite":                strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPSWrite, 'f', -1, 64),
		"ratelimitbucket":                  strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucket),
		"ratelimitbucketwrite":             strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucketWrite),
		"gchighthreshold":                  strconv.Itoa(DefaultKubernetesGCHighThreshold),
		"gclowthreshold":                   strconv.Itoa(DefaultKubernetesGCLowThreshold),
	},
	"1.12": {
		"dockerEngine":                     "1.13.*",
		"dashboard":                        "kubernetes-dashboard-amd64:v1.10.1",
		"addon-resizer":                    "addon-resizer:1.8.4",
		"exechealthz":                      "exechealthz-amd64:1.2",
		"heapster":                         "heapster-amd64:v1.5.4",
		"metrics-server":                   "metrics-server-amd64:v0.2.1",
		"coredns":                          "coredns:1.6.2",
		"kube-dns":                         "k8s-dns-kube-dns-amd64:1.15.4",
		"addon-manager":                    "kube-addon-manager-amd64:v8.9.1",
		"dnsmasq":                          "k8s-dns-dnsmasq-nanny-amd64:1.15.4",
		"pause":                            "pause:1.2.0",
		"tiller":                           "tiller:v2.13.1",
		"rescheduler":                      "rescheduler:v0.4.0",
		"aci-connector":                    "virtual-kubelet:latest",
		ContainerMonitoringAddonName:       "oms:ciprod10182019",
		AzureCNINetworkMonitoringAddonName: "networkmonitor:v0.0.6",
		"cluster-autoscaler":               "cluster-autoscaler:v1.12.8",
		NVIDIADevicePluginAddonName:        "k8s-device-plugin:1.11",
		"k8s-dns-sidecar":                  "k8s-dns-sidecar-amd64:1.14.10",
		"nodestatusfreq":                   DefaultKubernetesNodeStatusUpdateFrequency,
		"nodegraceperiod":                  DefaultKubernetesCtrlMgrNodeMonitorGracePeriod,
		"podeviction":                      DefaultKubernetesCtrlMgrPodEvictionTimeout,
		"routeperiod":                      DefaultKubernetesCtrlMgrRouteReconciliationPeriod,
		"backoffretries":                   strconv.Itoa(DefaultKubernetesCloudProviderBackoffRetries),
		"backoffjitter":                    strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffJitter, 'f', -1, 64),
		"backoffduration":                  strconv.Itoa(DefaultKubernetesCloudProviderBackoffDuration),
		"backoffexponent":                  strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffExponent, 'f', -1, 64),
		"ratelimitqps":                     strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPS, 'f', -1, 64),
		"ratelimitqpswrite":                strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPSWrite, 'f', -1, 64),
		"ratelimitbucket":                  strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucket),
		"ratelimitbucketwrite":             strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucketWrite),
		"gchighthreshold":                  strconv.Itoa(DefaultKubernetesGCHighThreshold),
		"gclowthreshold":                   strconv.Itoa(DefaultKubernetesGCLowThreshold),
	},
	"1.11": {
		"dockerEngine":                     "1.13.*",
		"dashboard":                        "kubernetes-dashboard-amd64:v1.10.1",
		"exechealthz":                      "exechealthz-amd64:1.2",
		"addon-resizer":                    "addon-resizer:1.8.4",
		"heapster":                         "heapster-amd64:v1.5.4",
		"metrics-server":                   "metrics-server-amd64:v0.2.1",
		"kube-dns":                         "k8s-dns-kube-dns-amd64:1.15.4",
		"addon-manager":                    "kube-addon-manager-amd64:v8.9.1",
		"dnsmasq":                          "k8s-dns-dnsmasq-nanny-amd64:1.15.4",
		"pause":                            "pause:1.2.0",
		"tiller":                           "tiller:v2.13.1",
		"rescheduler":                      "rescheduler:v0.4.0",
		"aci-connector":                    "virtual-kubelet:latest",
		ContainerMonitoringAddonName:       "oms:ciprod10182019",
		AzureCNINetworkMonitoringAddonName: "networkmonitor:v0.0.6",
		"cluster-autoscaler":               "cluster-autoscaler:v1.3.9",
		NVIDIADevicePluginAddonName:        "k8s-device-plugin:1.11",
		"k8s-dns-sidecar":                  "k8s-dns-sidecar-amd64:1.14.10",
		"nodestatusfreq":                   DefaultKubernetesNodeStatusUpdateFrequency,
		"nodegraceperiod":                  DefaultKubernetesCtrlMgrNodeMonitorGracePeriod,
		"podeviction":                      DefaultKubernetesCtrlMgrPodEvictionTimeout,
		"routeperiod":                      DefaultKubernetesCtrlMgrRouteReconciliationPeriod,
		"backoffretries":                   strconv.Itoa(DefaultKubernetesCloudProviderBackoffRetries),
		"backoffjitter":                    strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffJitter, 'f', -1, 64),
		"backoffduration":                  strconv.Itoa(DefaultKubernetesCloudProviderBackoffDuration),
		"backoffexponent":                  strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffExponent, 'f', -1, 64),
		"ratelimitqps":                     strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPS, 'f', -1, 64),
		"ratelimitqpswrite":                strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPSWrite, 'f', -1, 64),
		"ratelimitbucket":                  strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucket),
		"ratelimitbucketwrite":             strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucketWrite),
		"gchighthreshold":                  strconv.Itoa(DefaultKubernetesGCHighThreshold),
		"gclowthreshold":                   strconv.Itoa(DefaultKubernetesGCLowThreshold),
	},
	"1.10": {
		"dockerEngine":                     "1.13.*",
		"dashboard":                        "kubernetes-dashboard-amd64:v1.10.1",
		"exechealthz":                      "exechealthz-amd64:1.2",
		"addon-resizer":                    "addon-resizer:1.8.4",
		"heapster":                         "heapster-amd64:v1.5.4",
		"metrics-server":                   "metrics-server-amd64:v0.2.1",
		"kube-dns":                         "k8s-dns-kube-dns-amd64:1.15.4",
		"addon-manager":                    "kube-addon-manager-amd64:v8.9.1",
		"dnsmasq":                          "k8s-dns-dnsmasq-nanny-amd64:1.15.4",
		"pause":                            "pause:1.2.0",
		"tiller":                           "tiller:v2.13.1",
		"rescheduler":                      "rescheduler:v0.3.1",
		"aci-connector":                    "virtual-kubelet:latest",
		ContainerMonitoringAddonName:       "oms:ciprod10182019",
		AzureCNINetworkMonitoringAddonName: "networkmonitor:v0.0.6",
		"cluster-autoscaler":               "cluster-autoscaler:v1.2.5",
		NVIDIADevicePluginAddonName:        "k8s-device-plugin:1.10",
		"k8s-dns-sidecar":                  "k8s-dns-sidecar-amd64:1.14.8",
		"nodestatusfreq":                   DefaultKubernetesNodeStatusUpdateFrequency,
		"nodegraceperiod":                  DefaultKubernetesCtrlMgrNodeMonitorGracePeriod,
		"podeviction":                      DefaultKubernetesCtrlMgrPodEvictionTimeout,
		"routeperiod":                      DefaultKubernetesCtrlMgrRouteReconciliationPeriod,
		"backoffretries":                   strconv.Itoa(DefaultKubernetesCloudProviderBackoffRetries),
		"backoffjitter":                    strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffJitter, 'f', -1, 64),
		"backoffduration":                  strconv.Itoa(DefaultKubernetesCloudProviderBackoffDuration),
		"backoffexponent":                  strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffExponent, 'f', -1, 64),
		"ratelimitqps":                     strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPS, 'f', -1, 64),
		"ratelimitqpswrite":                strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPSWrite, 'f', -1, 64),
		"ratelimitbucket":                  strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucket),
		"ratelimitbucketwrite":             strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucketWrite),
		"gchighthreshold":                  strconv.Itoa(DefaultKubernetesGCHighThreshold),
		"gclowthreshold":                   strconv.Itoa(DefaultKubernetesGCLowThreshold),
	},
	"1.9": {
		"dockerEngine":                     "1.13.*",
		"dashboard":                        "kubernetes-dashboard-amd64:v1.10.1",
		"exechealthz":                      "exechealthz-amd64:1.2",
		"addon-resizer":                    "addon-resizer:1.8.4",
		"heapster":                         "heapster-amd64:v1.5.4",
		"metrics-server":                   "metrics-server-amd64:v0.2.1",
		"kube-dns":                         "k8s-dns-kube-dns-amd64:1.15.4",
		"addon-manager":                    "kube-addon-manager-amd64:v8.6",
		"dnsmasq":                          "k8s-dns-dnsmasq-nanny-amd64:1.15.4",
		"pause":                            "pause:1.2.0",
		"tiller":                           "tiller:v2.13.1",
		"rescheduler":                      "rescheduler:v0.3.1",
		"aci-connector":                    "virtual-kubelet:latest",
		ContainerMonitoringAddonName:       "oms:ciprod10182019",
		AzureCNINetworkMonitoringAddonName: "networkmonitor:v0.0.6",
		"cluster-autoscaler":               "cluster-autoscaler:v1.1.2",
		"k8s-dns-sidecar":                  "k8s-dns-sidecar-amd64:1.14.7",
		"nodestatusfreq":                   DefaultKubernetesNodeStatusUpdateFrequency,
		"nodegraceperiod":                  DefaultKubernetesCtrlMgrNodeMonitorGracePeriod,
		"podeviction":                      DefaultKubernetesCtrlMgrPodEvictionTimeout,
		"routeperiod":                      DefaultKubernetesCtrlMgrRouteReconciliationPeriod,
		"backoffretries":                   strconv.Itoa(DefaultKubernetesCloudProviderBackoffRetries),
		"backoffjitter":                    strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffJitter, 'f', -1, 64),
		"backoffduration":                  strconv.Itoa(DefaultKubernetesCloudProviderBackoffDuration),
		"backoffexponent":                  strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffExponent, 'f', -1, 64),
		"ratelimitqps":                     strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPS, 'f', -1, 64),
		"ratelimitqpswrite":                strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPSWrite, 'f', -1, 64),
		"ratelimitbucket":                  strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucket),
		"ratelimitbucketwrite":             strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucketWrite),
		"gchighthreshold":                  strconv.Itoa(DefaultKubernetesGCHighThreshold),
		"gclowthreshold":                   strconv.Itoa(DefaultKubernetesGCLowThreshold),
	},
	"1.8": {
		"dockerEngine":                     "1.13.*",
		"dashboard":                        "kubernetes-dashboard-amd64:v1.10.1",
		"exechealthz":                      "exechealthz-amd64:1.2",
		"addon-resizer":                    "addon-resizer:1.7",
		"heapster":                         "heapster-amd64:v1.5.1",
		"metrics-server":                   "metrics-server-amd64:v0.2.1",
		"kube-dns":                         "k8s-dns-kube-dns-amd64:1.14.13",
		"addon-manager":                    "kube-addon-manager-amd64:v8.6",
		"dnsmasq":                          "k8s-dns-dnsmasq-nanny-amd64:1.14.8",
		"pause":                            "pause:1.2.0",
		"tiller":                           "tiller:v2.13.1",
		"rescheduler":                      "rescheduler:v0.3.1",
		"aci-connector":                    "virtual-kubelet:latest",
		ContainerMonitoringAddonName:       "oms:ciprod10182019",
		AzureCNINetworkMonitoringAddonName: "networkmonitor:v0.0.6",
		"nodestatusfreq":                   DefaultKubernetesNodeStatusUpdateFrequency,
		"nodegraceperiod":                  DefaultKubernetesCtrlMgrNodeMonitorGracePeriod,
		"podeviction":                      DefaultKubernetesCtrlMgrPodEvictionTimeout,
		"routeperiod":                      DefaultKubernetesCtrlMgrRouteReconciliationPeriod,
		"backoffretries":                   strconv.Itoa(DefaultKubernetesCloudProviderBackoffRetries),
		"backoffjitter":                    strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffJitter, 'f', -1, 64),
		"backoffduration":                  strconv.Itoa(DefaultKubernetesCloudProviderBackoffDuration),
		"backoffexponent":                  strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffExponent, 'f', -1, 64),
		"ratelimitqps":                     strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPS, 'f', -1, 64),
		"ratelimitqpswrite":                strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPSWrite, 'f', -1, 64),
		"ratelimitbucket":                  strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucket),
		"ratelimitbucketwrite":             strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucketWrite),
		"gchighthreshold":                  strconv.Itoa(DefaultKubernetesGCHighThreshold),
		"gclowthreshold":                   strconv.Itoa(DefaultKubernetesGCLowThreshold),
	},
	"1.7": {
		"dockerEngine":                     "1.13.*",
		"dashboard":                        "kubernetes-dashboard-amd64:v1.6.3",
		"exechealthz":                      "exechealthz-amd64:1.2",
		"addon-resizer":                    "addon-resizer:1.7",
		"heapster":                         "heapster-amd64:v1.5.1",
		"metrics-server":                   "metrics-server-amd64:v0.2.1",
		"kube-dns":                         "k8s-dns-kube-dns-amd64:1.14.5",
		"addon-manager":                    "kube-addon-manager-amd64:v8.6",
		"dnsmasq":                          "k8s-dns-dnsmasq-nanny-amd64:1.14.5",
		"pause":                            "pause:1.2.0",
		"tiller":                           "tiller:v2.13.1",
		"rescheduler":                      "rescheduler:v0.3.1",
		"aci-connector":                    "virtual-kubelet:latest",
		ContainerMonitoringAddonName:       "oms:ciprod10182019",
		AzureCNINetworkMonitoringAddonName: "networkmonitor:v0.0.6",
		"nodestatusfreq":                   DefaultKubernetesNodeStatusUpdateFrequency,
		"nodegraceperiod":                  DefaultKubernetesCtrlMgrNodeMonitorGracePeriod,
		"podeviction":                      DefaultKubernetesCtrlMgrPodEvictionTimeout,
		"routeperiod":                      DefaultKubernetesCtrlMgrRouteReconciliationPeriod,
		"backoffretries":                   strconv.Itoa(DefaultKubernetesCloudProviderBackoffRetries),
		"backoffjitter":                    strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffJitter, 'f', -1, 64),
		"backoffduration":                  strconv.Itoa(DefaultKubernetesCloudProviderBackoffDuration),
		"backoffexponent":                  strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffExponent, 'f', -1, 64),
		"ratelimitqps":                     strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPS, 'f', -1, 64),
		"ratelimitqpswrite":                strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPSWrite, 'f', -1, 64),
		"ratelimitbucket":                  strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucket),
		"ratelimitbucketwrite":             strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucketWrite),
		"gchighthreshold":                  strconv.Itoa(DefaultKubernetesGCHighThreshold),
		"gclowthreshold":                   strconv.Itoa(DefaultKubernetesGCLowThreshold),
	},
	"1.6": {
		"dockerEngine":                     "1.12.*",
		"dashboard":                        "kubernetes-dashboard-amd64:v1.6.3",
		"exechealthz":                      "exechealthz-amd64:1.2",
		"addon-resizer":                    "addon-resizer:1.7",
		"heapster":                         "heapster-amd64:v1.3.0",
		"metrics-server":                   "metrics-server-amd64:v0.2.1",
		"kube-dns":                         "k8s-dns-kube-dns-amd64:1.14.5",
		"addon-manager":                    "kube-addon-manager-amd64:v6.5",
		"dnsmasq":                          "k8s-dns-dnsmasq-nanny-amd64:1.14.5",
		"pause":                            "pause:1.2.0",
		"tiller":                           "tiller:v2.13.1",
		"rescheduler":                      "rescheduler:v0.3.1",
		"aci-connector":                    "virtual-kubelet:latest",
		ContainerMonitoringAddonName:       "oms:ciprod10182019",
		AzureCNINetworkMonitoringAddonName: "networkmonitor:v0.0.6",
		"nodestatusfreq":                   DefaultKubernetesNodeStatusUpdateFrequency,
		"nodegraceperiod":                  DefaultKubernetesCtrlMgrNodeMonitorGracePeriod,
		"podeviction":                      DefaultKubernetesCtrlMgrPodEvictionTimeout,
		"routeperiod":                      DefaultKubernetesCtrlMgrRouteReconciliationPeriod,
		"backoffretries":                   strconv.Itoa(DefaultKubernetesCloudProviderBackoffRetries),
		"backoffjitter":                    strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffJitter, 'f', -1, 64),
		"backoffduration":                  strconv.Itoa(DefaultKubernetesCloudProviderBackoffDuration),
		"backoffexponent":                  strconv.FormatFloat(DefaultKubernetesCloudProviderBackoffExponent, 'f', -1, 64),
		"ratelimitqps":                     strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPS, 'f', -1, 64),
		"ratelimitqpswrite":                strconv.FormatFloat(DefaultKubernetesCloudProviderRateLimitQPSWrite, 'f', -1, 64),
		"ratelimitbucket":                  strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucket),
		"ratelimitbucketwrite":             strconv.Itoa(DefaultKubernetesCloudProviderRateLimitBucketWrite),
		"gchighthreshold":                  strconv.Itoa(DefaultKubernetesGCHighThreshold),
		"gclowthreshold":                   strconv.Itoa(DefaultKubernetesGCLowThreshold),
	},
}

// K8sComponentsByVersionMap represents Docker images used for Kubernetes components based on Kubernetes versions (major.minor.patch)
var K8sComponentsByVersionMap map[string]map[string]string

func init() {
	K8sComponentsByVersionMap = getKubeConfigs()
}

func getKubeConfigs() map[string]map[string]string {
	ret := make(map[string]map[string]string)
	for _, version := range common.GetAllSupportedKubernetesVersions(true, false) {
		ret[version] = getK8sVersionComponents(version, getVersionOverrides(version))
	}
	return ret
}

func getVersionOverrides(v string) map[string]string {
	switch v {
	case "1.8.11":
		return map[string]string{"kube-dns": "k8s-dns-kube-dns-amd64:1.14.9"}
	case "1.8.9":
		return map[string]string{"windowszip": "v1.8.9-2int.zip"}
	case "1.8.6":
		return map[string]string{"windowszip": "v1.8.6-2int.zip"}
	case "1.8.2":
		return map[string]string{"windowszip": "v1.8.2-2int.zip"}
	case "1.8.1":
		return map[string]string{"windowszip": "v1.8.1-2int.zip"}
	case "1.8.0":
		return map[string]string{"windowszip": "v1.8.0-2int.zip"}
	case "1.7.16":
		return map[string]string{"windowszip": "v1.7.16-1int.zip"}
	case "1.7.15":
		return map[string]string{"windowszip": "v1.7.15-1int.zip"}
	case "1.7.14":
		return map[string]string{"windowszip": "v1.7.14-1int.zip"}
	case "1.7.13":
		return map[string]string{"windowszip": "v1.7.13-1int.zip"}
	case "1.7.12":
		return map[string]string{"windowszip": "v1.7.12-2int.zip"}
	case "1.7.10":
		return map[string]string{"windowszip": "v1.7.10-1int.zip"}
	case "1.7.9":
		return map[string]string{"windowszip": "v1.7.9-2int.zip"}
	case "1.7.7":
		return map[string]string{"windowszip": "v1.7.7-2int.zip"}
	case "1.7.5":
		return map[string]string{"windowszip": "v1.7.5-4int.zip"}
	case "1.7.4":
		return map[string]string{"windowszip": "v1.7.4-2int.zip"}
	case "1.7.2":
		return map[string]string{"windowszip": "v1.7.2-1int.zip"}
	default:
		return nil
	}
}

func getK8sVersionComponents(version string, overrides map[string]string) map[string]string {
	s := strings.Split(version, ".")
	majorMinor := strings.Join(s[:2], ".")
	var ret map[string]string
	k8sComponent := k8sComponentVersions[majorMinor]
	switch majorMinor {
	case "1.17":
		ret = map[string]string{
			"hyperkube":                        "hyperkube-amd64:v" + version,
			"ccm":                              "cloud-controller-manager-amd64:v" + version,
			"windowszip":                       "v" + version + "-1int.zip",
			DashboardAddonName:                 k8sComponent["dashboard"],
			"exechealthz":                      k8sComponent["exechealthz"],
			"addonresizer":                     k8sComponent["addon-resizer"],
			"heapster":                         k8sComponent["heapster"],
			MetricsServerAddonName:             k8sComponent["metrics-server"],
			"coredns":                          k8sComponent["coredns"],
			"kube-dns":                         k8sComponent["kube-dns"],
			"addonmanager":                     k8sComponent["addon-manager"],
			"dnsmasq":                          k8sComponent["dnsmasq"],
			"pause":                            k8sComponent["pause"],
			TillerAddonName:                    k8sComponent["tiller"],
			ReschedulerAddonName:               k8sComponent["rescheduler"],
			ACIConnectorAddonName:              k8sComponent["aci-connector"],
			ContainerMonitoringAddonName:       k8sComponent[ContainerMonitoringAddonName],
			AzureCNINetworkMonitoringAddonName: k8sComponent[AzureCNINetworkMonitoringAddonName],
			ClusterAutoscalerAddonName:         k8sComponent["cluster-autoscaler"],
			"k8s-dns-sidecar":                  k8sComponent["k8s-dns-sidecar"],
			"nodestatusfreq":                   k8sComponent["nodestatusfreq"],
			"nodegraceperiod":                  k8sComponent["nodegraceperiod"],
			"podeviction":                      k8sComponent["podeviction"],
			"routeperiod":                      k8sComponent["routeperiod"],
			"backoffretries":                   k8sComponent["backoffretries"],
			"backoffjitter":                    k8sComponent["backoffjitter"],
			"backoffduration":                  k8sComponent["backoffduration"],
			"backoffexponent":                  k8sComponent["backoffexponent"],
			"ratelimitqps":                     k8sComponent["ratelimitqps"],
			"ratelimitqpswrite":                k8sComponent["ratelimitqpswrite"],
			"ratelimitbucket":                  k8sComponent["ratelimitbucket"],
			"ratelimitbucketwrite":             k8sComponent["ratelimitbucketwrite"],
			"gchighthreshold":                  k8sComponent["gchighthreshold"],
			"gclowthreshold":                   k8sComponent["gclowthreshold"],
			NVIDIADevicePluginAddonName:        k8sComponent[NVIDIADevicePluginAddonName],
		}
	case "1.16":
		ret = map[string]string{
			"hyperkube":                        "hyperkube-amd64:v" + version,
			"ccm":                              "cloud-controller-manager-amd64:v" + version,
			"windowszip":                       "v" + version + "-1int.zip",
			DashboardAddonName:                 k8sComponent["dashboard"],
			"exechealthz":                      k8sComponent["exechealthz"],
			"addonresizer":                     k8sComponent["addon-resizer"],
			"heapster":                         k8sComponent["heapster"],
			MetricsServerAddonName:             k8sComponent["metrics-server"],
			"coredns":                          k8sComponent["coredns"],
			"kube-dns":                         k8sComponent["kube-dns"],
			"addonmanager":                     k8sComponent["addon-manager"],
			"dnsmasq":                          k8sComponent["dnsmasq"],
			"pause":                            k8sComponent["pause"],
			TillerAddonName:                    k8sComponent["tiller"],
			ReschedulerAddonName:               k8sComponent["rescheduler"],
			ACIConnectorAddonName:              k8sComponent["aci-connector"],
			ContainerMonitoringAddonName:       k8sComponent[ContainerMonitoringAddonName],
			AzureCNINetworkMonitoringAddonName: k8sComponent[AzureCNINetworkMonitoringAddonName],
			ClusterAutoscalerAddonName:         k8sComponent["cluster-autoscaler"],
			"k8s-dns-sidecar":                  k8sComponent["k8s-dns-sidecar"],
			"nodestatusfreq":                   k8sComponent["nodestatusfreq"],
			"nodegraceperiod":                  k8sComponent["nodegraceperiod"],
			"podeviction":                      k8sComponent["podeviction"],
			"routeperiod":                      k8sComponent["routeperiod"],
			"backoffretries":                   k8sComponent["backoffretries"],
			"backoffjitter":                    k8sComponent["backoffjitter"],
			"backoffduration":                  k8sComponent["backoffduration"],
			"backoffexponent":                  k8sComponent["backoffexponent"],
			"ratelimitqps":                     k8sComponent["ratelimitqps"],
			"ratelimitqpswrite":                k8sComponent["ratelimitqpswrite"],
			"ratelimitbucket":                  k8sComponent["ratelimitbucket"],
			"ratelimitbucketwrite":             k8sComponent["ratelimitbucketwrite"],
			"gchighthreshold":                  k8sComponent["gchighthreshold"],
			"gclowthreshold":                   k8sComponent["gclowthreshold"],
			NVIDIADevicePluginAddonName:        k8sComponent[NVIDIADevicePluginAddonName],
		}
	case "1.15":
		ret = map[string]string{
			"hyperkube":                        "hyperkube-amd64:v" + version,
			"ccm":                              "cloud-controller-manager-amd64:v" + version,
			"windowszip":                       "v" + version + "-1int.zip",
			DashboardAddonName:                 k8sComponent["dashboard"],
			"exechealthz":                      k8sComponent["exechealthz"],
			"addonresizer":                     k8sComponent["addon-resizer"],
			"heapster":                         k8sComponent["heapster"],
			MetricsServerAddonName:             k8sComponent["metrics-server"],
			"coredns":                          k8sComponent["coredns"],
			"kube-dns":                         k8sComponent["kube-dns"],
			"addonmanager":                     k8sComponent["addon-manager"],
			"dnsmasq":                          k8sComponent["dnsmasq"],
			"pause":                            k8sComponent["pause"],
			TillerAddonName:                    k8sComponent["tiller"],
			ReschedulerAddonName:               k8sComponent["rescheduler"],
			ACIConnectorAddonName:              k8sComponent["aci-connector"],
			ContainerMonitoringAddonName:       k8sComponent[ContainerMonitoringAddonName],
			AzureCNINetworkMonitoringAddonName: k8sComponent[AzureCNINetworkMonitoringAddonName],
			ClusterAutoscalerAddonName:         k8sComponent["cluster-autoscaler"],
			"k8s-dns-sidecar":                  k8sComponent["k8s-dns-sidecar"],
			"nodestatusfreq":                   k8sComponent["nodestatusfreq"],
			"nodegraceperiod":                  k8sComponent["nodegraceperiod"],
			"podeviction":                      k8sComponent["podeviction"],
			"routeperiod":                      k8sComponent["routeperiod"],
			"backoffretries":                   k8sComponent["backoffretries"],
			"backoffjitter":                    k8sComponent["backoffjitter"],
			"backoffduration":                  k8sComponent["backoffduration"],
			"backoffexponent":                  k8sComponent["backoffexponent"],
			"ratelimitqps":                     k8sComponent["ratelimitqps"],
			"ratelimitqpswrite":                k8sComponent["ratelimitqpswrite"],
			"ratelimitbucket":                  k8sComponent["ratelimitbucket"],
			"ratelimitbucketwrite":             k8sComponent["ratelimitbucketwrite"],
			"gchighthreshold":                  k8sComponent["gchighthreshold"],
			"gclowthreshold":                   k8sComponent["gclowthreshold"],
			NVIDIADevicePluginAddonName:        k8sComponent[NVIDIADevicePluginAddonName],
		}
	case "1.14":
		ret = map[string]string{
			"hyperkube":                        "hyperkube-amd64:v" + version,
			"ccm":                              "cloud-controller-manager-amd64:v" + version,
			"windowszip":                       "v" + version + "-1int.zip",
			DashboardAddonName:                 k8sComponent["dashboard"],
			"exechealthz":                      k8sComponent["exechealthz"],
			"addonresizer":                     k8sComponent["addon-resizer"],
			"heapster":                         k8sComponent["heapster"],
			MetricsServerAddonName:             k8sComponent["metrics-server"],
			"coredns":                          k8sComponent["coredns"],
			"kube-dns":                         k8sComponent["kube-dns"],
			"addonmanager":                     k8sComponent["addon-manager"],
			"dnsmasq":                          k8sComponent["dnsmasq"],
			"pause":                            k8sComponent["pause"],
			TillerAddonName:                    k8sComponent["tiller"],
			ReschedulerAddonName:               k8sComponent["rescheduler"],
			ACIConnectorAddonName:              k8sComponent["aci-connector"],
			ContainerMonitoringAddonName:       k8sComponent[ContainerMonitoringAddonName],
			AzureCNINetworkMonitoringAddonName: k8sComponent[AzureCNINetworkMonitoringAddonName],
			ClusterAutoscalerAddonName:         k8sComponent["cluster-autoscaler"],
			"k8s-dns-sidecar":                  k8sComponent["k8s-dns-sidecar"],
			"nodestatusfreq":                   k8sComponent["nodestatusfreq"],
			"nodegraceperiod":                  k8sComponent["nodegraceperiod"],
			"podeviction":                      k8sComponent["podeviction"],
			"routeperiod":                      k8sComponent["routeperiod"],
			"backoffretries":                   k8sComponent["backoffretries"],
			"backoffjitter":                    k8sComponent["backoffjitter"],
			"backoffduration":                  k8sComponent["backoffduration"],
			"backoffexponent":                  k8sComponent["backoffexponent"],
			"ratelimitqps":                     k8sComponent["ratelimitqps"],
			"ratelimitqpswrite":                k8sComponent["ratelimitqpswrite"],
			"ratelimitbucket":                  k8sComponent["ratelimitbucket"],
			"ratelimitbucketwrite":             k8sComponent["ratelimitbucketwrite"],
			"gchighthreshold":                  k8sComponent["gchighthreshold"],
			"gclowthreshold":                   k8sComponent["gclowthreshold"],
			NVIDIADevicePluginAddonName:        k8sComponent[NVIDIADevicePluginAddonName],
		}
	case "1.13":
		ret = map[string]string{
			"hyperkube":                        "hyperkube-amd64:v" + version,
			"ccm":                              "cloud-controller-manager-amd64:v" + version,
			"windowszip":                       "v" + version + "-1int.zip",
			DashboardAddonName:                 k8sComponent["dashboard"],
			"exechealthz":                      k8sComponent["exechealthz"],
			"addonresizer":                     k8sComponent["addon-resizer"],
			"heapster":                         k8sComponent["heapster"],
			MetricsServerAddonName:             k8sComponent["metrics-server"],
			"coredns":                          k8sComponent["coredns"],
			"kube-dns":                         k8sComponent["kube-dns"],
			"addonmanager":                     k8sComponent["addon-manager"],
			"dnsmasq":                          k8sComponent["dnsmasq"],
			"pause":                            k8sComponent["pause"],
			TillerAddonName:                    k8sComponent["tiller"],
			ReschedulerAddonName:               k8sComponent["rescheduler"],
			ACIConnectorAddonName:              k8sComponent["aci-connector"],
			ContainerMonitoringAddonName:       k8sComponent[ContainerMonitoringAddonName],
			AzureCNINetworkMonitoringAddonName: k8sComponent[AzureCNINetworkMonitoringAddonName],
			ClusterAutoscalerAddonName:         k8sComponent["cluster-autoscaler"],
			"k8s-dns-sidecar":                  k8sComponent["k8s-dns-sidecar"],
			"nodestatusfreq":                   k8sComponent["nodestatusfreq"],
			"nodegraceperiod":                  k8sComponent["nodegraceperiod"],
			"podeviction":                      k8sComponent["podeviction"],
			"routeperiod":                      k8sComponent["routeperiod"],
			"backoffretries":                   k8sComponent["backoffretries"],
			"backoffjitter":                    k8sComponent["backoffjitter"],
			"backoffduration":                  k8sComponent["backoffduration"],
			"backoffexponent":                  k8sComponent["backoffexponent"],
			"ratelimitqps":                     k8sComponent["ratelimitqps"],
			"ratelimitqpswrite":                k8sComponent["ratelimitqpswrite"],
			"ratelimitbucket":                  k8sComponent["ratelimitbucket"],
			"ratelimitbucketwrite":             k8sComponent["ratelimitbucketwrite"],
			"gchighthreshold":                  k8sComponent["gchighthreshold"],
			"gclowthreshold":                   k8sComponent["gclowthreshold"],
			NVIDIADevicePluginAddonName:        k8sComponent[NVIDIADevicePluginAddonName],
		}
	case "1.12":
		ret = map[string]string{
			"hyperkube":                        "hyperkube-amd64:v" + version,
			"ccm":                              "cloud-controller-manager-amd64:v" + version,
			"windowszip":                       "v" + version + "-1int.zip",
			DashboardAddonName:                 k8sComponent["dashboard"],
			"exechealthz":                      k8sComponent["exechealthz"],
			"addonresizer":                     k8sComponent["addon-resizer"],
			"heapster":                         k8sComponent["heapster"],
			MetricsServerAddonName:             k8sComponent["metrics-server"],
			"coredns":                          k8sComponent["coredns"],
			"kube-dns":                         k8sComponent["kube-dns"],
			"addonmanager":                     k8sComponent["addon-manager"],
			"dnsmasq":                          k8sComponent["dnsmasq"],
			"pause":                            k8sComponent["pause"],
			TillerAddonName:                    k8sComponent["tiller"],
			ReschedulerAddonName:               k8sComponent["rescheduler"],
			ACIConnectorAddonName:              k8sComponent["aci-connector"],
			ContainerMonitoringAddonName:       k8sComponent[ContainerMonitoringAddonName],
			AzureCNINetworkMonitoringAddonName: k8sComponent[AzureCNINetworkMonitoringAddonName],
			ClusterAutoscalerAddonName:         k8sComponent["cluster-autoscaler"],
			"k8s-dns-sidecar":                  k8sComponent["k8s-dns-sidecar"],
			"nodestatusfreq":                   k8sComponent["nodestatusfreq"],
			"nodegraceperiod":                  k8sComponent["nodegraceperiod"],
			"podeviction":                      k8sComponent["podeviction"],
			"routeperiod":                      k8sComponent["routeperiod"],
			"backoffretries":                   k8sComponent["backoffretries"],
			"backoffjitter":                    k8sComponent["backoffjitter"],
			"backoffduration":                  k8sComponent["backoffduration"],
			"backoffexponent":                  k8sComponent["backoffexponent"],
			"ratelimitqps":                     k8sComponent["ratelimitqps"],
			"ratelimitqpswrite":                k8sComponent["ratelimitqpswrite"],
			"ratelimitbucket":                  k8sComponent["ratelimitbucket"],
			"ratelimitbucketwrite":             k8sComponent["ratelimitbucketwrite"],
			"gchighthreshold":                  k8sComponent["gchighthreshold"],
			"gclowthreshold":                   k8sComponent["gclowthreshold"],
			NVIDIADevicePluginAddonName:        k8sComponent[NVIDIADevicePluginAddonName],
		}
	case "1.11":
		ret = map[string]string{
			"hyperkube":                        "hyperkube-amd64:v" + version,
			"ccm":                              "cloud-controller-manager-amd64:v" + version,
			"windowszip":                       "v" + version + "-1int.zip",
			DashboardAddonName:                 k8sComponent["dashboard"],
			"exechealthz":                      k8sComponent["exechealthz"],
			"addonresizer":                     k8sComponent["addon-resizer"],
			"heapster":                         k8sComponent["heapster"],
			MetricsServerAddonName:             k8sComponent["metrics-server"],
			"kube-dns":                         k8sComponent["kube-dns"],
			"addonmanager":                     k8sComponent["addon-manager"],
			"dnsmasq":                          k8sComponent["dnsmasq"],
			"pause":                            k8sComponent["pause"],
			TillerAddonName:                    k8sComponent["tiller"],
			ReschedulerAddonName:               k8sComponent["rescheduler"],
			ACIConnectorAddonName:              k8sComponent["aci-connector"],
			ContainerMonitoringAddonName:       k8sComponent[ContainerMonitoringAddonName],
			AzureCNINetworkMonitoringAddonName: k8sComponent[AzureCNINetworkMonitoringAddonName],
			ClusterAutoscalerAddonName:         k8sComponent["cluster-autoscaler"],
			"k8s-dns-sidecar":                  k8sComponent["k8s-dns-sidecar"],
			"nodestatusfreq":                   k8sComponent["nodestatusfreq"],
			"nodegraceperiod":                  k8sComponent["nodegraceperiod"],
			"podeviction":                      k8sComponent["podeviction"],
			"routeperiod":                      k8sComponent["routeperiod"],
			"backoffretries":                   k8sComponent["backoffretries"],
			"backoffjitter":                    k8sComponent["backoffjitter"],
			"backoffduration":                  k8sComponent["backoffduration"],
			"backoffexponent":                  k8sComponent["backoffexponent"],
			"ratelimitqps":                     k8sComponent["ratelimitqps"],
			"ratelimitqpswrite":                k8sComponent["ratelimitqpswrite"],
			"ratelimitbucket":                  k8sComponent["ratelimitbucket"],
			"ratelimitbucketwrite":             k8sComponent["ratelimitbucketwrite"],
			"gchighthreshold":                  k8sComponent["gchighthreshold"],
			"gclowthreshold":                   k8sComponent["gclowthreshold"],
			NVIDIADevicePluginAddonName:        k8sComponent[NVIDIADevicePluginAddonName],
		}
	case "1.10":
		ret = map[string]string{
			"hyperkube":                        "hyperkube-amd64:v" + version,
			"ccm":                              "cloud-controller-manager-amd64:v" + version,
			"windowszip":                       "v" + version + "-1int.zip",
			DashboardAddonName:                 k8sComponent["dashboard"],
			"exechealthz":                      k8sComponent["exechealthz"],
			"addonresizer":                     k8sComponent["addon-resizer"],
			"heapster":                         k8sComponent["heapster"],
			MetricsServerAddonName:             k8sComponent["metrics-server"],
			"kube-dns":                         k8sComponent["kube-dns"],
			"addonmanager":                     k8sComponent["addon-manager"],
			"dnsmasq":                          k8sComponent["dnsmasq"],
			"pause":                            k8sComponent["pause"],
			TillerAddonName:                    k8sComponent["tiller"],
			ReschedulerAddonName:               k8sComponent["rescheduler"],
			ACIConnectorAddonName:              k8sComponent["aci-connector"],
			ContainerMonitoringAddonName:       k8sComponent[ContainerMonitoringAddonName],
			AzureCNINetworkMonitoringAddonName: k8sComponent[AzureCNINetworkMonitoringAddonName],
			"k8s-dns-sidecar":                  k8sComponent["k8s-dns-sidecar"],
			"nodestatusfreq":                   k8sComponent["nodestatusfreq"],
			"nodegraceperiod":                  k8sComponent["nodegraceperiod"],
			"podeviction":                      k8sComponent["podeviction"],
			"routeperiod":                      k8sComponent["routeperiod"],
			"backoffretries":                   k8sComponent["backoffretries"],
			"backoffjitter":                    k8sComponent["backoffjitter"],
			"backoffduration":                  k8sComponent["backoffduration"],
			"backoffexponent":                  k8sComponent["backoffexponent"],
			"ratelimitqps":                     k8sComponent["ratelimitqps"],
			"ratelimitqpswrite":                k8sComponent["ratelimitqpswrite"],
			"ratelimitbucket":                  k8sComponent["ratelimitbucket"],
			"ratelimitbucketwrite":             k8sComponent["ratelimitbucketwrite"],
			"gchighthreshold":                  k8sComponent["gchighthreshold"],
			"gclowthreshold":                   k8sComponent["gclowthreshold"],
			ClusterAutoscalerAddonName:         k8sComponent["cluster-autoscaler"],
			NVIDIADevicePluginAddonName:        k8sComponent[NVIDIADevicePluginAddonName],
		}
	case "1.9":
		ret = map[string]string{
			"hyperkube":                        "hyperkube-amd64:v" + version,
			"ccm":                              "cloud-controller-manager-amd64:v" + version,
			"windowszip":                       "v" + version + "-1int.zip",
			DashboardAddonName:                 k8sComponent["dashboard"],
			"exechealthz":                      k8sComponent["exechealthz"],
			"addonresizer":                     k8sComponent["addon-resizer"],
			"heapster":                         k8sComponent["heapster"],
			MetricsServerAddonName:             k8sComponent["metrics-server"],
			"kube-dns":                         k8sComponent["kube-dns"],
			"addonmanager":                     k8sComponent["addon-manager"],
			"dnsmasq":                          k8sComponent["dnsmasq"],
			"pause":                            k8sComponent["pause"],
			TillerAddonName:                    k8sComponent["tiller"],
			ReschedulerAddonName:               k8sComponent["rescheduler"],
			ACIConnectorAddonName:              k8sComponent["aci-connector"],
			ContainerMonitoringAddonName:       k8sComponent[ContainerMonitoringAddonName],
			AzureCNINetworkMonitoringAddonName: k8sComponent[AzureCNINetworkMonitoringAddonName],
			"k8s-dns-sidecar":                  k8sComponent["k8s-dns-sidecar"],
			"nodestatusfreq":                   k8sComponent["nodestatusfreq"],
			"nodegraceperiod":                  k8sComponent["nodegraceperiod"],
			"podeviction":                      k8sComponent["podeviction"],
			"routeperiod":                      k8sComponent["routeperiod"],
			"backoffretries":                   k8sComponent["backoffretries"],
			"backoffjitter":                    k8sComponent["backoffjitter"],
			"backoffduration":                  k8sComponent["backoffduration"],
			"backoffexponent":                  k8sComponent["backoffexponent"],
			"ratelimitqps":                     k8sComponent["ratelimitqps"],
			"ratelimitqpswrite":                k8sComponent["ratelimitqpswrite"],
			"ratelimitbucket":                  k8sComponent["ratelimitbucket"],
			"ratelimitbucketwrite":             k8sComponent["ratelimitbucketwrite"],
			"gchighthreshold":                  k8sComponent["gchighthreshold"],
			"gclowthreshold":                   k8sComponent["gclowthreshold"],
			ClusterAutoscalerAddonName:         k8sComponent["cluster-autoscaler"],
		}
	case "1.8":
		ret = map[string]string{
			"hyperkube":                        "hyperkube-amd64:v" + version,
			"ccm":                              "cloud-controller-manager-amd64:v" + version,
			"windowszip":                       "v" + version + "-1int.zip",
			DashboardAddonName:                 k8sComponent["dashboard"],
			"exechealthz":                      k8sComponent["exechealthz"],
			"addonresizer":                     k8sComponent["addon-resizer"],
			"heapster":                         k8sComponent["heapster"],
			MetricsServerAddonName:             k8sComponent["metrics-server"],
			"kube-dns":                         k8sComponent["kube-dns"],
			"addonmanager":                     k8sComponent["addon-manager"],
			"dnsmasq":                          k8sComponent["dnsmasq"],
			"pause":                            k8sComponent["pause"],
			TillerAddonName:                    k8sComponent["tiller"],
			ReschedulerAddonName:               k8sComponent["rescheduler"],
			ACIConnectorAddonName:              k8sComponent["aci-connector"],
			ContainerMonitoringAddonName:       k8sComponent[ContainerMonitoringAddonName],
			AzureCNINetworkMonitoringAddonName: k8sComponent[AzureCNINetworkMonitoringAddonName],
			"nodestatusfreq":                   k8sComponent["nodestatusfreq"],
			"nodegraceperiod":                  k8sComponent["nodegraceperiod"],
			"podeviction":                      k8sComponent["podeviction"],
			"routeperiod":                      k8sComponent["routeperiod"],
			"backoffretries":                   k8sComponent["backoffretries"],
			"backoffjitter":                    k8sComponent["backoffjitter"],
			"backoffduration":                  k8sComponent["backoffduration"],
			"backoffexponent":                  k8sComponent["backoffexponent"],
			"ratelimitqps":                     k8sComponent["ratelimitqps"],
			"ratelimitqpswrite":                k8sComponent["ratelimitqpswrite"],
			"ratelimitbucket":                  k8sComponent["ratelimitbucket"],
			"ratelimitbucketwrite":             k8sComponent["ratelimitbucketwrite"],
			"gchighthreshold":                  k8sComponent["gchighthreshold"],
			"gclowthreshold":                   k8sComponent["gclowthreshold"],
		}
	case "1.7":
		ret = map[string]string{
			"hyperkube":                        "hyperkube-amd64:v" + version,
			DashboardAddonName:                 k8sComponent["dashboard"],
			"exechealthz":                      k8sComponent["exechealthz"],
			"addonresizer":                     k8sComponent["addon-resizer"],
			"heapster":                         k8sComponent["heapster"],
			MetricsServerAddonName:             k8sComponent["metrics-server"],
			"kube-dns":                         k8sComponent["kube-dns"],
			"addonmanager":                     k8sComponent["addon-manager"],
			"dnsmasq":                          k8sComponent["dnsmasq"],
			"pause":                            k8sComponent["pause"],
			TillerAddonName:                    k8sComponent["tiller"],
			ReschedulerAddonName:               k8sComponent["rescheduler"],
			ACIConnectorAddonName:              k8sComponent["aci-connector"],
			ContainerMonitoringAddonName:       k8sComponent[ContainerMonitoringAddonName],
			AzureCNINetworkMonitoringAddonName: k8sComponent[AzureCNINetworkMonitoringAddonName],
			"nodestatusfreq":                   k8sComponent["nodestatusfreq"],
			"nodegraceperiod":                  k8sComponent["nodegraceperiod"],
			"podeviction":                      k8sComponent["podeviction"],
			"routeperiod":                      k8sComponent["routeperiod"],
			"backoffretries":                   k8sComponent["backoffretries"],
			"backoffjitter":                    k8sComponent["backoffjitter"],
			"backoffduration":                  k8sComponent["backoffduration"],
			"backoffexponent":                  k8sComponent["backoffexponent"],
			"ratelimitqps":                     k8sComponent["ratelimitqps"],
			"ratelimitqpswrite":                k8sComponent["ratelimitqpswrite"],
			"ratelimitbucket":                  k8sComponent["ratelimitbucket"],
			"ratelimitbucketwrite":             k8sComponent["ratelimitbucketwrite"],
			"gchighthreshold":                  k8sComponent["gchighthreshold"],
			"gclowthreshold":                   k8sComponent["gclowthreshold"],
		}
	case "1.6":
		ret = map[string]string{
			"hyperkube":                        "hyperkube-amd64:v" + version,
			DashboardAddonName:                 k8sComponent["dashboard"],
			"exechealthz":                      k8sComponent["exechealthz"],
			"addonresizer":                     k8sComponent["addon-resizer"],
			"heapster":                         k8sComponent["heapster"],
			MetricsServerAddonName:             k8sComponent["metrics-server"],
			"kube-dns":                         k8sComponent["kube-dns"],
			"addonmanager":                     k8sComponent["addon-manager"],
			"dnsmasq":                          k8sComponent["dnsmasq"],
			"pause":                            k8sComponent["pause"],
			TillerAddonName:                    k8sComponent["tiller"],
			ReschedulerAddonName:               k8sComponent["rescheduler"],
			ACIConnectorAddonName:              k8sComponent["aci-connector"],
			AzureCNINetworkMonitoringAddonName: k8sComponent[AzureCNINetworkMonitoringAddonName],
			"nodestatusfreq":                   k8sComponent["nodestatusfreq"],
			"nodegraceperiod":                  k8sComponent["nodegraceperiod"],
			"podeviction":                      k8sComponent["podeviction"],
			"routeperiod":                      k8sComponent["routeperiod"],
			"backoffretries":                   k8sComponent["backoffretries"],
			"backoffjitter":                    k8sComponent["backoffjitter"],
			"backoffduration":                  k8sComponent["backoffduration"],
			"backoffexponent":                  k8sComponent["backoffexponent"],
			"ratelimitqps":                     k8sComponent["ratelimitqps"],
			"ratelimitqpswrite":                k8sComponent["ratelimitqpswrite"],
			"ratelimitbucket":                  k8sComponent["ratelimitbucket"],
			"ratelimitbucketwrite":             k8sComponent["ratelimitbucketwrite"],
			"gchighthreshold":                  k8sComponent["gchighthreshold"],
			"gclowthreshold":                   k8sComponent["gclowthreshold"],
		}

	default:
		ret = nil
	}
	for k, v := range overrides {
		ret[k] = v
	}
	return ret
}
